package com.tgra;

import com.badlogic.gdx.Gdx;

public class Cell {

	Wall wallobj = new Wall();
	Floor floorobj = new Floor();
	Sphere sphere = new Sphere(12,30);
	
	public static final float WALL_LENGTH = 1.1f;
	public static final float WALL_THICKNESS = 0.1f;
	
	public boolean northWall;
	public boolean westWall;
	public boolean floor;
	public boolean isVisted;
	public boolean isGoal;
	int x;
	int z;

	public Cell()
	{
		northWall = false;
		westWall = false;
		floor = false;
		isVisted = false;
		isGoal = false;
	}

	public Cell(boolean west, boolean south, boolean f)
	{
		northWall = west;
		westWall = south;
		floor = f;
	}

	public void draw()
	{
		// draw floor of cell
		if (this.floor)
		{
			Gdx.gl11.glPushMatrix();
			Gdx.gl11.glTranslatef(0.5f, 0.0f, 0.5f);    //translate-a cellum svo indexinn verdi i efra vinstra horninu
			Gdx.gl11.glScalef(1.0f, 0.02f, 1.0f);
			floorobj.draw();
			Gdx.gl11.glPopMatrix();
		}
		// draw sphere in goal cell
		if(this.isGoal)
		{
			Gdx.gl11.glPushMatrix();
			Gdx.gl11.glTranslatef(0.5f, 0.0f, 0.5f);    //translate-a cellum svo indexinn verdi i efra vinstra horninu
			Gdx.gl11.glTranslatef(0.0f, 0.4f, 0.0f); 
			Gdx.gl11.glScalef(0.1f, 0.1f, 0.1f);
			sphere.draw();
			Gdx.gl11.glPopMatrix();
		}
		//draw walls
		// draw northwall
		if (this.northWall)
		{
			Gdx.gl11.glPushMatrix();
			Gdx.gl11.glTranslatef(0.5f, 0.0f, 0.5f);    //translate-a tvi indexinn er i efra vinstra horninu
			Gdx.gl11.glTranslatef(0.0f, 0.5f, -0.5f);
			Gdx.gl11.glScalef(WALL_LENGTH, 1.0f, WALL_THICKNESS);
			wallobj.draw();
			Gdx.gl11.glPopMatrix();			
		}
		// draw westwall
		if (this.westWall)
		{
			Gdx.gl11.glPushMatrix();
			Gdx.gl11.glTranslatef(0.5f, 0.0f, 0.5f);    //translate-a tvi indexinn er i efra vinstra horninu
			Gdx.gl11.glTranslatef(-0.5f, 0.5f, 0.0f);
			Gdx.gl11.glScalef(WALL_THICKNESS, 1.0f, WALL_LENGTH);
			wallobj.draw();
			Gdx.gl11.glPopMatrix();			
		}
	}

}
